home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gtlayout.lha
/
Source
/
LT_Build.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-09-09
|
29KB
|
1,182 lines
/*
** GadTools layout toolkit
**
** Copyright © 1993-1998 by Olaf `Olsen' Barthel
** Freely distributable.
**
** :ts=4
*/
#ifndef _GTLAYOUT_GLOBAL_H
#include "gtlayout_global.h"
#endif
/*****************************************************************************/
#include <stdarg.h>
/*****************************************************************************/
#include "Assert.h"
/*****************************************************************************/
/****** gtlayout.library/LT_BuildA ******************************************
*
* NAME
* LT_BuildA -- turn the user interface specs into a window
* and gadgets.
*
* SYNOPSIS
* Window = LT_BuildA(Handle,Tags);
* D0 A0 A1
*
* struct Window *LT_BuildA(LayoutHandle *,struct TagItem *);
*
* Window = LT_Build(Handle,...);
*
* struct Window *LT_Build(LayoutHandle *,...);
*
* FUNCTION
* This is the big one. After building up a user interface specification
* using LT_NewA() a call to LT_BuildA() will finally lay out the single
* user interface elements, open a window and put the gadgets, etc.
* inside.
*
* The code tries to fit all the gadgets into the window, but if it
* runs out of space it will fall back to a different font and
* rescale the user interface objects to match it. It will first
* fall back onto the system default font. If unsuccessful it will
* as a last resort try to use topaz.font/8.
*
* To make it easier to distinguish between different handles that
* share the same Window->UserPort, the Window->UserData pointer
* will point to the LayoutHandle that created it (V13).
*
* NOTE: Earlier library releases did not support this feature,
* so be prepared to deal with Window->UserData == NULL.
*
* INPUTS
* Handle - Pointer to a LayoutHandle structure.
*
* Tags - Pointer to TagItem list controlling window
* and layout attributes.
*
*
* All the tag values given are passed straight away to OpenWindowTags(),
* see intuition.doc for more information.
*
* In addition to this a number of private tag values are supported:
*
* LAWN_Menu (struct Menu *) - The menu to attach to the window. The
* IDCMP flags will be updated to include IDCMP_MENUPICK if this
* tag is used.
*
* LAWN_MenuTemplate (struct NewMenu *) - A list of filled-in
* NewMenu structures which will get passed straight through
* to LT_NewMenuTemplate(). If a menu could be created, it will
* be attached to the window. LT_DeleteHandle() will then later
* automatically dispose of the menu. Please note that the window
* may fail to open due to the menu layout going wrong. Separate
* calls to LT_NewMenuTemplate() and LT_Build() may be a better
* approach since it is easier to find out which process went
* wrong. You will find a pointer to the menu attached to the
* LayoutHandle in LayoutHandle->Menu. Please note that this
* entry only exists in LayoutHandles created by gtlayout.library
* v13 or higher. (V13)
*
* NOTE: This tag effectively overrides LAWN_Menu.
*
* LAWN_MenuTags (struct TagItem *) - A list of TagItems which
* will get passed straight through to LT_NewMenuTagList().
* Even if you don't ask for it, LT_Build() will pass
* "LAMN_Handle,<Handle>" in for you, so any additional tags
* specifying screen, fonts, etc. will be overridden. If a menu
* could be created, it will be attached to the window.
* LT_DeleteHandle() will then later automatically dispose of the
* menu. Please note that the window may fail to open due to the
* menu layout going wrong. Separate calls to LT_NewMenuTagList()
* and LT_Build() may be a better approach since it is easier to
* find out which process went wrong. You will find a pointer to the
* menu attached to the LayoutHandle in LayoutHandle->Menu. Please note
* that this entry only exists in LayoutHandles created by
* gtlayout.library v13 or higher. (V13)
*
* NOTE: This tag effectively overrides LAWN_Menu and has
* precedence over LAWN_MenuTemplate.
*
* LAWN_UserPort (struct MsgPort *) - The MsgPort to use as the
* window user port. The MsgPort will be attached using the
* common ModifyIDCMP() method, closing the window will
* first remove and reply all pending messages at this port.
*
* LAWN_Left (LONG) - The left edge position the window is to use.
* This effectively overrides any horizontal alignment flags.
*
* NOTE: the code may choose to ignore this value if it finds
* that the window will not fit onto the screen unless
* the left edge position is changed.
*
* LAWN_Top (LONG) - The top edge position the window is to use.
* This effectively overrides any vertical alignment flags.
*
* NOTE: the code may choose to ignore this value if it finds
* that the window will not fit onto the screen unless
* the top edge position is changed.
*
* LAWN_Zoom (BOOL) - Adds a zoom gadget to the window. Clicking
* on this gadget will cause the window to shrink/zoom back
* to its original position. This differs from the WA_Zoom
* tag behaviour. When the window zooms back to its original
* position the gadgets are automatically refreshed.
* Default: FALSE
*
* LAWN_MaxPen (LONG) - The maximum rendering pen index your code
* will use. Since you are -- with some restrictions -- allowed
* to render into the window created you may want to avoid
* silly side effects if drawing images or other colourful
* textures which do not share the common user interface colours.
* By default the layout code will change the maximum rendering
* pen number for the window to include only the user interface
* pen colours. This can, but need not disturb your own private
* window rendering.
* Look up graphics.library/SetMaxPen for more information.
* Default: determined by looking up Screen->DrawInfo.dri_Pens
*
* LAWN_BelowMouse (BOOL) - This instructs the layout routine to
* centre the window created -- if possible -- below the
* mouse pointer. This effectively ignores any left edge,
* top edge or alignment settings.
* Default: FALSE
*
* LAWN_MoveToWindow (BOOL) - When the window is finally open the
* user interface code will try to make sure the entire window
* is visible on the screen, this may involve moving the
* currently visible portion of an autoscrolling screen.
* Default: TRUE
*
* LAWN_AutoRefresh (BOOL) - Handle IDCMP_REFRESHWINDOW events
* automatically.
* Default: TRUE
*
* LAWN_HelpHook (struct Hook *) - Hook code to invoke when the user
* presses the "Help" key. See gtlayout.h for more information.
* Default: NULL
*
* LAWN_Parent (struct Window *) - Parent window to centre the child
* window in.
* Default: NULL
*
* LAWN_BlockParent (BOOL) - Lock the parent window via LT_LockWindow()
* until the child window is closed.
*
* NOTE: requires LAWN_Parent attribute.
*
* Default: FALSE
*
* LAWN_SmartZoom (BOOL) - Attach a zoom gadget to the window created.
* When in zoomed state, the window will be as small as possible,
* showing only the window title and window gadgets:
*
* NOTE: this tag implies LAWN_Zoom,TRUE
*
* Default: FALSE
*
* LAWN_Title (STRPTR) - The window title to use. Use this tag in
* place of WA_Title or you will break the layout code.
* Default: no title
*
* LAWN_Bounds (struct IBox *) - Bounds to centre the window in.
* Default: NULL
*
* LAWN_ExtraWidth (LONG) - Extra width to add into the calculation
* when opening the window.
* Default: 0
*
* LAWN_ExtraHeight (LONG) - Extra height to add into the calculation
* when opening the window.
* Default: 0
*
* LAWN_IDCMP (ULONG) - Use this tag in place of WA_IDCMP or you
* will break the object handling code.
*
* LAWN_AlignWindow (UWORD) - Alignment information for the window, must
* be a mask made from the following bit values:
*
* ALIGNF_RIGHT - Align to screen right edge
* ALIGNF_LEFT - Align to screen left edge
* ALIGNF_TOP - Align to screen top edge
* ALIGNF_BOTTOM - Al